#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <tr1/unordered_map>

using namespace std;
using namespace std::tr1;

typedef long long ll;

const int MAXN = 6e5+10;
const int LIM = 6e5;
const int mod = 1000000007;

int mu[MAXN],smu[MAXN],prime[MAXN],primenum;
int n;
bool np[MAXN];

unordered_map <int,int> ansmu;

void shai(){
	for(int i = 2;i <= LIM;i++){
		if(!np[i]){
			prime[++primenum] = i;
			mu[i] = -1;
		}
		for(int j = 1;j <= primenum && prime[j] * i <= LIM;j++){
			np[i * prime[j]] = 1;
			mu[i * prime[j]] = -mu[i];
			if(i % prime[j] == 0){
				mu[i * prime[j]] = 0;
				break;
			}
		}
	}
	mu[1] = 1;
	for(int i = 1;i <= LIM;i++) smu[i] = smu[i-1] + mu[i];
}

ll gmu(int x){
	if(x <= LIM) return smu[x];
	if(ansmu[x]) return ansmu[x];
	ll ans = 1;
	for(int l = 2,r;l <= x;l=r+1){
		r = min(x,x/(x/l));
		ans = ans - gmu(x/l) * (r-l+1);
	}
	return ansmu[x] = ans;
}

ll p2(ll x){x%=mod;return x*x%mod;}

ll cal(int x){
	ll ans = 0;
	for(int l = 1,r;l <= x;l = r+1){
		r = min(x,x/(x/l));
		ans = (ans + x/l*(r-l+1)%mod)%mod;
	}
	return ans % mod;
}

int main (){
	scanf("%d",&n);
	shai();
	ll ans = 0;
	for(int l = 1,r;l <= n;l = r+1){
		r = min(n,n/(n/l));
		ans = (ans + ((gmu(r) - gmu(l-1)) % mod + mod) % mod * p2(cal(n/l)) % mod) % mod;
	}
	printf("%lld\n",ans);
	return 0;
}
